Android EMM AppConfig - google-play-services

I am trying to setup AppConfig variables through our EMM server for an internal-only app.
I have reviewed the documentation "Set up managed configurations" here https://developer.android.com/work/managed-configurations and verified that my AndroidManifest.xml and app_restrictions.xml files are correctly populated.
AndroidManifesst.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
<application>
...
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths"></meta-data>
<meta-data
android:name="android.content.APP_RESTRICTIONS"
android:resource="#xml/app_restrictions"></meta-data>
</provider>
</application>
...
</manifest>
app_restrictions.xml:
<?xml version="1.0" encoding="utf-8"?>
<restrictions xmlns:android="http://schemas.android.com/apk/res/android">
<restriction
android:key="app_configurator"
android:title="#string/app_configurator"
android:restrictionType="bool"
android:defaultValue="false">
</restriction>
<restriction
android:key="z_number"
android:title="#string/z_number"
android:restrictionType="string"
android:defaultValue="Testing123">
</restriction>
</restrictions>
In testing, using the Test DPC app with Device Owner:
the button "LOAD APP MANIFEST RESTRICTIONS" does nothing (when I expect it should load the details defined in app_restrictions.xml)
if I manually add the keys and values my app responds as expected
When publishing, through Managed Google Play and setting up the app from our EMM solution:
the app configuration tab is not populated with any parameters and a message "This app doesn't support app configuration." is shown leaving no way to configure the app.
Given that the app does respond when the values are set, but the inability to set the values seems to indicate the Test DPC and the EMM solution cannot read the values of my app_restrictions.xml.
The documentation indicates that the above two files are all that is needed. However, I have seen some reference to Google Play services providing this information to MDMs so I'm not sure I understand the process here to investigate further.
Hoping someone could help me with some pointers.

In the AndroidManifest.xml file, the location of the 'meta-data' tag is incorrect. The issue is resolved after the following update:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
<application>
<meta-data
android:name="android.content.APP_RESTRICTIONS"
android:resource="#xml/app_restrictions"></meta-data>
...
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths"></meta-data>
</provider>
</application>
...
</manifest>

Related

Multi-App Kiosk mode provisioning failure code '0xC00CE223'

I'm trying to put in place a kiosk on a Surface Go using the following AssignedAccess.xml file in my provisioning package:
<?xml version="1.0" encoding="utf-8" ?>
<AssignedAccessConfiguration
xmlns="https://schemas.microsoft.com/AssignedAccess/2017/config"
xmlns:r1809="https://schemas.microsoft.com/AssignedAccess/201810/config"
>
<Profiles>
<Profile Id="{f46cfb9f-044f-4d96-bb33-ea1c1c18a354}">
<AllAppsList>
<AllowedApps>
<App AppUserModelId="Microsoft.Windows.Explorer" r1809:AutoLaunch="true" />
<App AppUserModelId="Microsoft.WindowsCalculator_8wekyb3d8bbwe!App" />
<App DesktopAppPath="C:\Program Files\SumatraPDF\SumatraPDF.exe" />
</AllowedApps>
</AllAppsList>
<r1809:FileExplorerNamespaceRestrictions>
<r1809:AllowedNamespace Name="Downloads" />
</r1809:FileExplorerNamespaceRestrictions>
<StartLayout>
<![CDATA[<LayoutModificationTemplate xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout" Version="1" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification">
<LayoutOptions StartTileGroupCellWidth="6" />
<DefaultLayoutOverride>
<StartLayoutCollection>
<defaultlayout:StartLayout GroupCellWidth="6">
<start:Group Name="Apps">
<start:Tile Size="4x2" Column="0" Row="2" AppUserModelID="Microsoft.WindowsCalculator_8wekyb3d8bbwe!App" />
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationLinkPath="%APPDATA%\Microsoft\Windows\Start Menu\Programs\SumatraPDF.lnk" />
<start:DesktopApplicationTile Size="2x2" Column="2" Row="0" DesktopApplicationLinkPath="%APPDATA%\Microsoft\Windows\Start Menu\Programs\System Tools\File Explorer.lnk" />
</start:Group>
</defaultlayout:StartLayout>
</StartLayoutCollection>
</DefaultLayoutOverride>
</LayoutModificationTemplate>
]]>
</StartLayout>
<Taskbar ShowTaskbar="false" />
</Profile>
</Profiles>
<Configs>
<Config>
<Account>CouncilKiosk</Account>
<DefaultProfile Id="{f46cfb9f-044f-4d96-bb33-ea1c1c18a354}"/>
</Config>
</Configs>
</AssignedAccessConfiguration>
I took a look at the logs and the consensus seems to be this error code '0xC00CE223'. According to my research this is telling me that "Validate failed because the document does not contain exactly one root node." (XML DOM Error Messages Doc) I'm not sure where this is going wrong.
The provisioning package is also setting 2 user accounts (local admin and local user), hiding OOBE, enabling tablet mode as default, and running a provisioning command script that installs a single application and sets registry keys necessary for autologin.
UPDATE: I re-imaged the Surface Go with Windows 10 Pro and it still fails. But now I get an error '0x8000FFFF' which appears to be related to windows update and the windows store. I only have 1 USB port on this thing so it isn't connected to the internet at this time.
UPDATE 2: I re-imaged with a more up to date ISO of 10 Pro and I'm back to the original errors listed in the above post. I have updated the XML file and changed the tag as well as the xmlns from rs5 to r1809. I am not seeing any changes and this continues to be a frustrating problem to have.
Test to change this:
https://schemas.microsoft.com/AssignedAccess/2017/config
to the following:
http://schemas.microsoft.com/AssignedAccess/2017/config

productFlavors application Id

I'm trying to make two types of builds in Android Studio usung productFlavors.
I need to have unique applicationId for each buld type.
And here is an issue:
First of all I add this code to my gradle file
productFlavors {
base {
applicationId "ru.Public.lib"
}
city {
applicationId "ru.Public.lib.city"
}
Then when I'm trying to build app with city type, Android Studio shows an error:
"Error:Execution failed for task ':app:processBaseDebugGoogleServices'.
No matching client found for package name 'ru.Public.lib.debug'"
After this I decided that I need to change package name at my Manifest file.
I tryed to change package name in Manifest by three ways:
In project structure I created new Manifest app > src > city > AndroidManifest.xml. At this file I use package="ru.Public.lib.city"
I didn't create a new Manifest. Instead of it I used a placehilder for package name like this: package="${applicationId}"
I combined these two methods: "using placeholder at new Manifest in app > src > city >"
All shown ways gives me an error in the Manifest: Android Studio colored activity names by red and says unsolved class 'Activity Name'
Here is a part of my Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ru.Public.lib">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:name="ru.Public.lib.app.Application"
android:hardwareAccelerated="true"
android:icon="#mipmap/icon"
android:label="#string/app_name"
android:largeHeap="true"
android:resizeableActivity="false"
android:supportsRtl="true"
android:theme="#style/AppTheme.NoActionBarDefault">
<activity
android:name=".activities.ActivityMain"
android:configChanges="orientation|keyboardHidden">
</activity>
<activity
android:name=".activities.ActivityEdition"
android:configChanges="orientation|screenSize|keyboardHidden">
</activity>
.....................................................................etc.
</manifest>
So. It looks like I need to recreate all my acivities in new directories acording to every packege name I need. But it is too complicated way. I'm sure that Google solved this problem.
Do anybody have some ideas about this issue?
Thanks!
Here are some step to solve it.
Go to your firebase console
Select your previous project and Add another app
Register another applicationId (Register all of your applicationID one by one)
Then Download new google-services.json
And place new google-services.json in your project
Thats it

Xamarin Android app crashes when using GCM

Im following the tutorial to add Google Cloud Messaging to your xamarin android project (Walkthrough - Using Remote Notifications in Xamarin.Android).
But im having trouble trying to connect to Google Services.
Everytime i try to build/ run my app, Visual Studio just trys to launch the app but then stops about a second later.
Heres the output message:
Android application is debugging. The application could not be
started. Ensure that the application has been installed to the target
device and has a launchable activity (MainLauncher = true).
Additionally, check Build->Configuration Manager to ensure this
project is set to Deploy for this configuration.
Here is my manifest file also:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="PushNotificationsAndroid.PushNotificationsAndroid"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="auto">
<uses-sdk android:minSdkVersion="16" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INTERNET" />
<user-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="PushNotificationsAndroid.PushNotificationsAndroid.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="PushNotificationsAndroid.PushNotificationsAndroid.permission.C2D_MESSAGE" />
<application android:label="PushNotificationsAndroid"></application>
</manifest>
I commented out some of the permission lines and this issue seems just to happen when i added the line:
<permission android:name="PushNotificationsAndroid.PushNotificationsAndroid.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
Can anyone give me some advice to why this is happening?
Found a solution. I just had to make the package name lowercase for some reason
com.notifications.pushnotificationsandroid

NoClassDefFoundError Google-Play-Services / Maps

Getting NoClassDefFoundError within project and in Google Maps for Android sample found in google-play-services folder.
I have tried so far:
Importing google-play-services_lib into workspace through wizard and making sure code is copied to directory
Manually copying google-play-services_lib into directory with sample, then importing into workspace
Copying jar into workspace
Google Play Services is installed on test devices (Nexus 5, Galaxy S4)
There is a green check next to the library under my project when going to properties > android
I can see the classes in source at compile time, compiles with no errors
Reinstalled the lib from the Android SDK Manager and made sure the key is correct in Google API console; also made sure v2 of maps was enabled for that key
Added proguard exceptions as per integration instructions
Any ideas?
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.package.projectname"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="21" />
<permission
android:name="com.package.projectname.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.package.projectname.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.package.projectname.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.package.projectname.MapActivity"
android:label="#string/title_activity_map"
android:parentActivityName="com.package.projectname.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.package.projectname.MainActivity" />
</activity>
<uses-library
android:name="com.google.android.maps"
android:required="true" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value=“my_key_from_google_api_console” />
</application>
</manifest>
I don't think you need the line:
<uses-library
android:name="com.google.android.maps"
android:required="true" />
In fact, I think that's the name of the old maps library. Try removing it and see if that fixes your problem. Also, make sure your code is importing from com.google.android.gms.maps and com.google.android.gms.maps.model, the packages for Google Maps API V2.
UPDATE
Your build configuration isn't including the Google Play Services jar in your APK.
To fix this in IntelliJ: https://stackoverflow.com/a/17977734/1235702
To fix this in Eclipse, follow steps 3 and 4 here: https://docs.google.com/document/pub?id=19nQzvKP-CVLd7_VrpwnHfl-AE9fjbJySowONZZtNHzw (I didn't write this doc, but kudos to whoever did!)
Add the Google Play Services project into your Eclipse workspace.
Click File -> Import..., select Android -> Existing Android Code into Workspace
Browse to and select /extras/google/google_play_services/libproject/google-play-services_lib
To add the dependency to Google Play Services into your project
Project -> Properties -> Android -> Library, Add -> google-play-services_lib
(Sorry; the markdown won't let me set the numbers to 3 and 4 explicitly.)
Screenshot from OP for posterity:

Windows 8 App Manifest: Image Assets Error

These images default VS images.But it doesn't work.
Error 4 Payload file
'C:\Users\Mert\documents\visual studio 2012\Projects\Y\P\Assets\StoreLogo.scale-100.png' does not exist.
Error 3 Payload file
'C:\Users\Mert\documents\visual studio 2012\Projects\Y\P\Assets\SplashScreen.scale-100.png' does not exist.
Error 2 Payload file
'C:\Users\Mert\documents\visual studio 2012\Projects\Y\P\Assets\SmallLogo.targetsize-32.png' does not exist.
Error 1 Payload file
'C:\Users\Mert\documents\visual studio 2012\Projects\Y\P\Assets\SmallLogo.scale-100.png' does not exist.
I know question is incomprehensible but I don't find different way to explain.
Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
<Identity Name="" Publisher="CN=Mert" Version="1.0.0.0" />
<Properties>
<DisplayName>Y</DisplayName>
<PublisherDisplayName>Mert</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Prerequisites>
<OSMinVersion>6.2.1</OSMinVersion>
<OSMaxVersionTested>6.2.1</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="Y.App">
<VisualElements DisplayName="Y" Logo="Assets\Logo.png" SmallLogo="Assets\SmallLogo.png" Description="Y" ForegroundText="light" BackgroundColor="#464646">
<DefaultTile ShowName="allLogos" />
<SplashScreen Image="Assets\SplashScreen.png" />
</VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
</Package>
I also had this problem last day. I noticed that when I deleted an image from assert, it wont delete its occurrence from the Solution explorer in Visual Studio. Delete those files from solution explorer fixed the issue.
Cheers...!
I just encountered this myself.
It seems Visual Studio can't handle a trial-and-error approach for logos.
I got rid of it by manually editing the .csproj file and removing the missing assets from there.
There is a workaround by setting the Generate App Bundle setting to Never.