I have an Android app which is basically a Player. My users sometimes uses my app with a connected Bluetooth device like Speaker, Headphone, Car etc.
I have no special code to use or manage Bluetooth. But since Android OS managing it, my users able to use Bluetooth devices without any development from my side.
Lately i got some feedback that my app not playing well on Bluetooth devices and sound freezing or flickering. And they are saying they have no problems with other apps like Spotify, Youtube etc. Also i could not find any issue in my tests.
So any idea what problem can be? Is there anything i can implement to prevent it. Is there any way that i can reproduce that problem?
I don't know it will fix the issue. But for a try, can you please provide the following permission in your app's AndroidManifest.xml
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
Related
My app has to adjust the screen brightness of the phone. To do so, I needed the following permission:
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
Android Studio shows the following error, when I hover over the permission:
Permission is only granted to system apps
But: the code still works when I upload it to my phone. Can somebody explain me why? Furthermore, I'd need to know, if this code will also work, if the user downloads the app from Google Play.
Is there a different approach to change the screen brightness?
I have developed an android app. All the things are working fine but the main problem is, using the Hack App Data anyone can see the ad codes which is a very dangerous threat.
Now how can i prevent hack app to open my application or edit my application data or how can i prevent hack app data to access this sensitive information?
note: I have turned off android:exported="false" and also add <permission android:protectionLevel="signature"
android:name="apricot.com.newshunt"/> to my menifest file
you can set the Copy Protection to On in the Android Market upload page. It's near the bottom. I doubt it is fool-proof but it can help keep some of the people likely to do this from being able to.
You should add the view in Java instead of XML and obfuscate your code.
I've read several other questions regarding this same topic however I am still at my wit's end trying to figure out how to get my Watchface to appear on my Android Wear device, let alone publish it to the Play Store.
The project has a mobile app which houses a blank activity and then the Wear app (Watchface) which houses the activity for the Watchface.
I've attempted the following
signing both Wear and mobile apks and installing then both on my phone (mobile app shows with blank activity but no Wear Watchface available on watch)
installing the signed Wear apk separately (also does not display as a selectable Watchface)
running the Wear Watchface in the Android Studio emulator (works)
making sure that the same permissions exist in both mobile and Wear manifests
ensuring that all project IDs match up and are the same
Any advice or help would be great.
Writing watch face to wear 1.x.x or 2.0 involves extending your Java class to The CanvasWatchFaceService class and registering your watch face in the manifest and also working with the CanvasWatchFaceService.Engine class.
You don't have to create an Activity you will have to create a view and inflate or mostly draw the view in “void onDraw(Canvas canvas, Rect bounds)”. You have to register the service in your manifest like as shown below.
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="#drawable/preview_face" />
<meta-data
android:name=
"com.google.android.wearable.watchface.preview_circular"
android:resource="#drawable/preview_face_circular" />
Also You have to have Wake lock permission
<uses-permission android:name="android.permission.WAKE_LOCK" />
we need to add a special intent filter with the goal that watch.
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category
android:name=
"com.google.android.wearable.watchface.category.WATCH_FACE" />
</intent-filter>
It will be usual signed android apk to publish within playstore no much of difference.
Also there are plenty of resources that will get you started like medium blogs and reddit blogs and so on.
Check this book for more information on Wear : Android wear Projects
After much digging, I was able to get to the solution.
In order for a watch face or a wear apk to be moved on the watch for debugging purposes, one must ensure the following
Ensure all of these items are met in addition to the following.
Turn on debugging in both the Android Wear application as well as on the watch itself. (Debugging on the watch can be turned on by enabling developer options by tapping the build number) You would want to enable debugging over bluetooth
Your phone should also be plugged into to a computer that has adb and enable adb debugging on the device itself.
Typing adb-devices in Command Prompt will list all of the devices found
Connect the debugger to the watch by adb forward tcp:4444 localabstract:/adb-hub
adb connect 127.0.0.1:4444
Ensure that both target and Host are connected by opening the Android Wear companion app, tap settings and viewing the status message that appears under the bluetooth debugging toggle option. It should read Host: connected
Target: connected
adb-devices should now show both the phone and the watch. From here on you can use adb commands to push the wear apk to the watch.
Source
I'm trying to turn airplanemode on on Android but I got the following message:
java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.AIRPLANE_MODE
From my point of view (and some researches):
(1) I'm using all necessary permission to do that:
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
(2) The code is not wrong:
Settings.Global.putInt(
context.getContentResolver(),
Settings.Global.AIRPLANE_MODE_ON, 1);
Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
intent.putExtra("state", true);
context.sendBroadcast(intent);
I know that the app needs to be installed as a system app, so I'm installing that under /system/app/my-app/ (I tried /system/priv-app/my-app/ too) and added all the permissions to the folder and to the apk.
The last thing that I tried was the include of android:sharedUserId="android.uid.system" at the AndroidManifest.xml, but doing that the application disappears.
What am I missing here, after all those attempts?
ps: The device is rooted.
Thanks in advance
It seems although Airplane Mode has become a Constant value as of API Level 17 as per the Android development documentation.
Why are you turning airplane mode on? Is there a certain functionality you are trying to accomplish?
I would've posted this in the comments, but I don't have enough rep... tfw
I'm programming an Android application, and I would like to do so that it doesn't shut down the screen, ever.Pretty much like a car gps app that keeps the screen on.
Would someone know how to do this with phonegap ?
If its not possible in Javascript, is there an easy way to do it in Java but inside the main Phonegap function ?
Thank you
use this property in the ManiFestFile
<uses-permission android:name="android.permission.WAKE_LOCK"/>
and add this in the required Activity
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);