How Can I test Google Actions in Android app? - android

Using App action test tools in Android Studio for testing Google Actions, I'm getting the error
Preview Creation Error Status Code: 400 Message: Precondition check failed.
The requested Android app package name does not have an associated project
in Play Console. Please create a draft in Play Console and upload an app
with package name 'com.example.yadayada'.
If I try to "upload an app with packagename ..."
I'm getting the error
Upload failed
You have uploaded an APK or Android App Bundle that contains an action schema
document in the manifest file, but the action patterns are not yet allowed.
If you participate in a beta program, you must obtain authorization
for your developer account
Ok, but where and how can i do it ?
Furthermore, I don't have to publish an application, this is just a draft to test the implementation of possible future Slices, and the documentation states that it is possible to do it through the Android Studio plugin.

Ok, got it. Hints here
Create a new application in developer console without actions, and use
its package name in the test application with actions. You can use any package names that you have already registered in Console
android {
defaultConfig {
applicationId "com.example.yadayada.playconsole"
}
}

You need to add this to the manifest file:
<meta-data
android:name="android.app.shortcuts"
android:resource="#xml/shortcuts" />
This is explained in the app actions tutorial and also here: https://developer.android.com/guide/topics/ui/shortcuts/creating-shortcuts#static

Related

Expo build apk : ExponentToken not generated

I created my first expo app, who can send notification to multiple users. I use the expo-notification package to generate the ExponentToken and handle incoming notification.
Everythings works perfecly when I use the expo go app, but recently I build my app in apk with eas
$ eas build -p android --profile genAPK
//the genAPK profile :
build: {
"genAPK":{
"android": {
"buildType":"apk"
}
}
}
I downloaded the builded apk, but when my real app want to generate the ExponentToken it just not works and return me a empty string... (I know it because my app crash do a alert() if the token is empty)
I don't know if this help, but I dont use the firebase way, I use the expo node sdk and my own database and API to store tokens and send notifications
Is this a common mistake and how can I fix this ?
Or at least can I see the output of my package even if this is a apk ?
Thanks in advance
My notification is also not working when i upgrade to EAS.
And i found this in Expo discord group:
No experienceId or projectId found. If one or the other can't be inferred from the manifest (eg. in bare workflow), you have to pass one in yourself.
at http://192.168.7.186:8081/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&minify=false:102608:321 in _createSuperInternal
at node_modules/expo-modules-core/build/errors/CodedError.js:10:8 in constructor
at http://192.168.7.186:8081/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&minify=false:313197:49 in getExpoPushTokenAsync$
There is a problem with ExpoPushToken, and you can see the source of this error from here expo-notifications-repo. The cause of this error in my case is the projectId, because in the expo-notifications-repo they use expo-constant package which have change in the latest SDK. So i need to add projectId to my app.json
"extra":{
"eas":{
"projectId":"(PROJECT_ID-Expo.dev)"
}
}

Google Play Services sign in not working well on Unity Android

I'm trying to add Google Play Services on my Unity Android project.
I've got already implement google play services plugin to my project. Filling the all crediantials. I've got 2 different internal test accounts on developer console.
Here is my question:
Account A: SignInStatus Success and not showing welcome pop-up
message.
Account B: SignInStatus Canceled and not sign in.
Is it because internal test or something?
unity version: 2019.4.16f1
gpgs plugin verison: 0.11.01
Here is my code:
referanced: https://github.com/playgameservices/play-games-plugin-for-unity
using GooglePlayGames;
private bool Authenticated;
public void Start() {
PlayGamesPlatform.Instance.Authenticate(ProcessAuthentication);
}
internal void ProcessAuthentication(SignInStatus status) {
if (status == SignInStatus.Success) {
// Continue with Play Games Services
Authenticated = true;
} else {
// Disable your integration with Play Games Services or show a login button
// to ask users to sign-in. Clicking it should call
// PlayGamesPlatform.Instance.ManuallyAuthenticate(ProcessAuthentication).
Authenticated = false;
}
}
There is nothing wrong with your code.
I just created a new project, got a new SHA-1, added my account to the new google play console and verified that everything was tested successfully.
In doing so, we found the following problems:
If you are using the 11.01 version, please check if there is a problem by following the procedure below.
Follow the steps below to check.
(Assets → External Dependency Manager → Android Resolver → Force Resolve)
Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml:11: Repo path 'Packages/com.google.play.games/Editor/m2repository' does not exist.
If the above error occurs, you can solve it by choosing one of two solutions.
First, see comments by #greg-hanes here.
The specific method is to create a GooglePlayGamesPluginDependencies.xml file inside the Assets/GooglePlayGames/com.google.play.games/Editor/m2repository folder and paste the following contents.
<?xml version="1.0" encoding="UTF-8" ?>
<dependencies>
<!-- Internal library dependency generated at build time.
It also defines the transitive dependencies on play-services
-->
<androidPackages>
<androidPackage spec="com.google.games:gpgs-plugin-support:0.11.01">
<repositories>
<repository>Assets/GooglePlayGames/com.google.play.games/Editor/m2repository</repository>
</repositories>
</androidPackage>
</androidPackages>
</dependencies>
And then Force Resolve again.
(Gradle failed to fetch dependencies on the way. If you get an error, make sure your JDK path is set correctly.)
Second, downgrade the version to version 10.14.
Here is my code that I wrote to run only once at runtime. It works successfully when I run it.
using UnityEngine;
using GooglePlayGames;
using GooglePlayGames.BasicApi;
public static class Login
{
[RuntimeInitializeOnLoadMethod]
public static void SignIn()
{
PlayGamesPlatform.Instance.Authenticate(success =>
{
Debug.Log(success ? "Success Login" : "Failed Login");
});
}
}
You can check the logs on Android by installing the Android Logcat package.
I hate the 11.01 version so I'm using the 10.14 version :)
Hope your problem is solved!

Verify non-Google Play app installs using Play core library

Some context: Most of us may have faced this ResourceNotFoundException when we migrated to Android app bundle release method. It is evident that the issue is because of Side-loading the app. Reference here.
Google recently announced solution to this problem. Using play core library we can identify whether the app is side-loaded or not (Identifies the missing split apks). If the app is side-loaded it shows "Installation failed" popup and redirects to play store, where user can properly install the app via the Google Play store.
Problem: Everything works fine until the installation of missing split apks from play store. Now when I relaunch the app, it immediately crashes with an error saying.
Default FirebaseApp is not initialised in this process
Note: Directly downloading the app from play store works perfectly fine without any crash. The crash happens only when the app re-downloads because of side loading issue.
Code:
Project's build.gradle:
buildscript {
dependencies {
classpath 'com.android.tools.build:bundletool:0.9.0'
}
}
App module's build.gradle:
implementation 'com.google.android.play:core:1.6.1'
Class that extends Application:
public void onCreate() {
if (MissingSplitsManagerFactory.create(this).disableAppIfMissingRequiredSplits()) {
// Skip app initialization.
return;
}
super.onCreate();
.....
}
Any help would be really great.
I have solved this issue with the latest version of Play core library:
App module's build.gradle:
implementation "com.google.android.play:core:1.7.2"
Other implementation remains same.
A class that extends Application:
public void onCreate() {
if (MissingSplitsManagerFactory.create(this).disableAppIfMissingRequiredSplits()) {
// Skip app initialization.
return;
}
super.onCreate();
.....
}
How to test:
A better way to test it properly is to release the app bundle with these above fixes in play store internal test channel (Add yourself as a tester).
Simulate installing invalid apks - Use bundletool to get .apks file out of bundle, extract it and install base_master.apk using adb command
adb install base_master.apk.
Launch the app, you should see "Installation failed" dialog and it redirects to Play store, clicking on Update, play store will install the missing apks.
Launching the app should work properly by now.
Hope this helps

Android ANR in MyFirebaseInstanceIDService just in one product flavor

In my app I have two product flavors. Both of them used to work fine. Suddenly I started to get ANR error when I try to run the application and the app freezes during start up. The error in Logcat is:
ANR in com.myapp.development
PID: 7937
Reason: executing service com.myapp.development/com.myapp.development.service.MyFirebaseInstanceIDService
The method MyFirebaseInstanceIDService.onTokenRefresh is never called. The app freezes before any of my own code is executed.
The production flavor still works fine.
Everything in the Firebase console is set up correctly. The app is in the Play Store and both flavors used to work.
productFlavors {
production {
applicationId 'com.myapp'
dimension "default"
}
development {
applicationId 'com.myapp.development'
dimension "default"
}
}
As you can see the only difference between the two flavors is the application id. And if I change the application id in the developmnet flavour it starts to work (the app does not freeze).
I tried the following tests:
I change the package id of the development flavor by adding just one letter: 'com.myapp.developmentX'. I also make the corresponding change in google-services.json file . Then the development flavor also starts. But of course Firebase services do not work, because the new application id is not configured in Firebase console.
In the manifest file I remove the MyFirebaseMessagingService and MyFirebaseMessagingService and MyFirebaseInstanceIDService. Then the app still freezes at start up, but the error in logcat changes slightly:
ANR in com.myapp.development
PID: 683
Reason: executing service com.myapp.development/com.google.firebase.iid.FirebaseInstanceIdService
I checked out an old git branch and tried to start it but the problem is still there.
I also tried: Uninstall the app and install again. Clean project. Delete the build directories. Restart the test device. Use the Android emulator. Restart the computer. Restart Android Studio. Update Android Studio to the latest 3.1.4 for Mac. But non of these helped.
It looks like the problem has something to do with the application id and Firebase, but I cannot find what.
Anyone has any ideas?
Update after comments from Shark and sebasira.
In Firebase console I have one single project and there are two applications defined for it - one for each flavour. In that case there is no need of multiple google-services.json, one for each flavour. The file is the same for all flavours and can be places in the root directory :
app/
google-services.json
The file structure is like that:
{
"project_info": {...},
"client": [...],
}
As you see, there is an array of clients. All application IDs (all flavours) are defined in that array. That's why if I download from Firebase the google-services.json file for each application, they are all the same.
Anyway, I tried to put a different google-services.json file for each flavor like that:
app/src/
flavor1/google-services.json
flavor2/google-services.json
But that didn't help.
I was facing exactly same issue, and my app configuration was also exactly similar as yours.
The issue was caused by the latest Facebook SDK I was using in my code, it crashes the Firebase before the app start hence the app goes to ANR.
I set my Facebook SDK version as 4.35.0 and that solved the issue.
Try it out and let me know if it was helpful.

Android “Not_Market_Managed” error

I have published my app in alpha mode. But i am getting this response while licensing my application. I have set the test accounts as well.I have set the License Test Response as "Licensed". But still getting the Not_Market_Managed error.Please help
Make sure you have incremented your version code in your app build.gradle file. If you are trying to publish a new version of your app and the version code is the same, you cannot publish.
I had a similar story. In my case, I added a new flavor and applicationIdSuffix so the package name changed. I thought that the problem was that the application was not uploaded into the play market but when uploading it got an error :
"Upload failed
Your APK needs to have the package name _my_old_packagename_ ". Then I commented out the applicationIdSuffix and the problem was solved. The application did not even need to be uploaded since the application ran under the published account.

Categories

Resources