Instead of using the Data Layer and sending the data to phone, and uploading it from there, I simply wrote this code under a button:
Firebase ref = new Firebase("https://poponfa-8a11a.firebaseio.com/");
ref.child("lol").setValue("lol");
But for some strange reason, it usually suddenly stops working, pressing the button uploads nothing to firebase even though the phone is connected to the watch and internet. My question is, why is this behaviour occurring and how do I go about uploading directly from Wear, as I don't want to keep services running in the mobile App.
Haven't tried this personally, but you may want to try Identifying your Wear app as standalone.
Add the following in your Android Manifest file:
<application>
...
<meta-data
android:name="com.google.android.wearable.standalone"
android:value="true" />
...
</application>
With this, a watch app can be considered as one of the following:
Completely independent of a phone app
Semi-independent (a phone app is not required and would provide only
optional features)
Dependent on a phone app
Then, you can proceed with saving data directly from your Wear.
See Read and Write Data on Android for more information.
Related
I'm provisioning Android devices in Device-Owner mode via QR code. The device owner app is from our EMM tool (Ivanit EPM).
The Provisioning itself works fine, but the problem is, that after the provisioning the Backup Service is not accessible (greyed out).
But one of our customers, needs it to restore the contacts from the old devices.
I already searched a lot, and found something to enable Backup Service (see link below), but not with QR code method.
https://developer.android.com/reference/android/app/backup/package-summary
This is the QR code in Text with line breaks:
{ 'android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME': 'afw.com.landesk.ldmsagent/com.landesk.ldmsagent.DeviceAdmin',
'android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION': 'http://community.ivanti.com/downloads/patch/component/LD2016/android-AFW-prod.apk',
'android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM': 'hOYijtSjVpTKDz1KT_TGoP8cPyDbH_nuxJkIzWpNn7E',
'android.app.extra.PROVISIONING_SKIP_ENCRYPTION': true }
Does somebody has an ideas, how to get the Backup Service working again?
Is there a way with android.app.extra.PROVISIONING, or is there a way to give the settings from an xml or json or something?
I'm trying to set-up the remote configuration for my app with MobileIron EMM. I've done everything as described in developer guide:
1. I've set-up the manifest:
...
<meta-data
android:name="android.content.APP_RESTRICTIONS"
android:resource="#xml/app_restrictions"/>
</application>
2. I've described the restriction:
<?xml version="1.0" encoding="utf-8"?>
<restrictions xmlns:android="http://schemas.android.com/apk/res/android">
<restriction
android:title="#string/some_title"
android:key="SOME_KEY"
android:restrictionType="string"
android:defaultValue="123"/>
</restrictions>
3. I'm trying to receive it as following:
RestrictionsManager manager = (RestrictionsManager) context.getSystemService(Context.RESTRICTIONS_SERVICE);
Bundle b = manager.getApplicationRestrictions();
if(b!=null){
if(b.containsKey("SOME_KEY")) {
return b.getString("SOME_KEY");
}else{
System.out.println("bundle is not null");
for (String s: b.keySet()){
System.out.println("key in b is : " + s);
}
System.out.println(b.isEmpty() + " bundle is empty");
}
}else{
System.out.println("Bundle is null");
}
return "";
}
I've always got the output:
bundle is not null
true bundle is empty
although I've set the default value for the restriction. Why am I not getting at least default value for the restriction? Why am I never get an actual values (at the server side I've set the values with MobileIron Cloud and its AppConnect configuration)? Tried with several devices. What am I missing? Please help. My goal is to remotely set-up some key-value to the app.
If you're not receiving any restrictions at all then it's probably because your app isn't part of a managed profile. App restrictions only work in two scenarios... your device has been provisioned using your EMM console (can only be done after a factory reset) or your device has an Android for Work profile that is managed by your EMM console. You don't actually need to declare each restriction in the manifest, that only allows the EMM to provide that information in their console.
The easiest way to test your app restrictions on an unprovisioned device is to download the Test DPC app from the google play store. Setting it up will encrypt your device and install a work profile you can use for testing. You can use the DPC app to simulate applying app restrictions, reading the restrictions from manifest, and a number of other things EMMs do. You can install your app on the work profile using adb or by following the developer's guide to tell Android Studio how run the app in your work profile.
https://developer.android.com/work/guide.html#testing
These two posts should help post1 and post2.
Fred helped me understand from those posts, but to summarize:
If an item has not been explicitly set by a managed configurations provider, then that item will not be in the Bundle. An empty, but "not null" bundle just means nothing has been set by a managed configurations provider. The defaultValue in the managed configurations XML file is not used here. And the app is not being actively managed.
To get the defaultValue, query the configuration item's value using this RestrictionsManager.getManifestRestrictions(). It returns a list of all the RestrictionEntry objects as they are set in the managed configuration XML file. This means the value of the item is the defaultValue as defined in the XML file.
I had the same problem. We have tested with an Xamarin csharp app, used the public google test app "Test DPC" available via Play Store. It has a button "Load manifest restrictions" that should be able to load the app restrictions defined (it did not, in my case anyway).
It worked only, if:
I did NOT debugged the application (there the values applied with DPC always not defined/empty) but started at the device directly, and
add/set the key/value pairs manually within the Test DPC app.
Then I got my boolean values switched from within DPC... (ensure you pressed "Save" within "Manage applications" screen)
I have developed one android application. Now we are testing this application in production environment.
I have to track the below information with out depending on tester to share the log file,
Send Log file. May be Logcat data. Foe Example If any web service fails we need to write that into log file then same needs to be sent to the server or to given mail id.
If there is any crash in our app then we can get the stach track by using getDefaultUncaughtExceptionHandler then we need to send the stack trace info via mail or send it to web server.
Or else I can use any solution provider like Google Analytics, Crashlytics or else I can write the log data to text file. And then same to be sent via mail on a daily or weekly basis.
Help me on this.
It's about time you move to crashlytics https://try.crashlytics.com/ or critisism http://www.crittercism.com/ check it out, infact there is ton of other options out there
With a service like http://www.apteligent.com (Crittercism renamed to Apteligent), when looking at a crash, you'll be able to automatically see a log of: web service calls, network connectivity changes, changes to screen views, and app foreground/background events that led up to the crash without manually adding any additional logging to your app:
https://www.apteligent.com/2016/03/working-automatic-breadcrumbs/
I have two apps. one of the two has a custom content provider which works like a charm.
APP A -> The one with the provider
APP B -> The one that needs the data from the provider
Everything works fine in this scenario:
1st : Install app A
2nd: Install app B
However when I do it like this:
1st: Install app B
2nd: Install app A
I get the error :
09-19 13:07:22.576: E/AndroidRuntime(14621): Caused by: java.lang.SecurityException: Permission Denial: opening provider
uk.co.ringsizer.ui.BirthProvider from ProcessRecord{450c14c8 14621:uk.co.gemtv/u0a360}
(pid=14621, uid=10360) requires com.eir.provider.Size.READ_DATABASE
or com.eir.provider.Size.WRITE_DATABASE
My permissions are clearly stated in the manifest file and they are correct since it works if I install the apps in a different order.
It's the first time I'm using Content provider and I am relatively new to Android so the problem might be obvious to more experienced developers.
Any ideas? Has anybody else experienced the same issue before?
Thanks in advance.
The app that defines the custom <permission> must be installed before the app that requests it via <uses-permission>. If they are installed in the wrong order, the <uses-permission> app does not get the permission and must be uninstalled and reinstalled.
Custom permissions in general are risky for SDK apps.
Make sure that BOTH apps have the permission attribute in the manifest.
<permission android:name="com.example.permission.READ" />
I had only the use-permission attribute in the consuming app, and had exactly this problem. It'll work if the content provider app is installed first, but will fail if the content provider app is installed second.
When the consuming client app has the permission attribute as well, it will work regardless of app install order.
I am trying to port an android project to a BB10 app. I have followed the instructions to implement BB Push as closely as I can. I have successfully registered one of our apps on push, but when I try and register another the server returns with "TOO_MANY_REGISTRATIONS" on the GCM intent. Any help appreciated.
Project 1 - android.cfg (values changed for security and to illustrate point)
<android>
<push>
<appid>XXX1-XXXXXXXXXXXXXXXXXXXXXX</appid>
<ppgurl>https://cpXXX1.pushapi.na.blackberry.com</ppgurl>
<tokenprefix></tokenprefix>
</push>
</android>
Project 2 - android.cfg
<android>
<push>
<appid>XXX2-XXXXXXXXXXXXXXXXXXXXXX</appid>
<ppgurl>https://cpXXX2.pushapi.na.blackberry.com</ppgurl>
<tokenprefix></tokenprefix>
</push>
</android>
EDIT:
I tested both the apps on same phone (Z10), so as I understand it, it would've generated same device token?
I eventually solved the issue. I had to security wipe the phone. This isn't necessarily needed though. I did not understand that on BB10 you need to delete the app to clear cache. So it may have been possible just to delete app and reinstall.
After reinstalling my apps from a fresh OS, it works perfectly. Also good to note:
<ppgurl>http://cpXXX2.pushapi.na.blackberry.com</ppgurl>
http not https, otherwise you get INVALID_SENDER