I am building an android app which needs to create a calendar event. I use the following code for this:
Intent calIntent = new Intent(Intent.ACTION_INSERT);
calIntent.setData(CalendarContract.Events.CONTENT_URI);
startActivity(calIntent);
The calendar even adding activity opens up but shows a dialog box-"Before you add a calendar event, you must add atleast one calendar event to your device and make a calendar visible"
So i add an account by entering my Google email id and password and i get the error:
Cant safely connect to server.(java.security.cert.CertPathValidator
Exception: trust anchor for certificate path not found.)
Anyone else who got this issue? how to get this to work?
You need to install the google play services in the genymotion virtual device in order to use your Google account for the calendar application.
To achive this purpose, follow this steps:
Download ARM Translation Installer v1.1
Download the correct GApps for your Android version. Here the last version for Android 5.1 or here the 4.4 version.
Open your Genymotion VM and go to the Homescreen, drag&drop the Genymotion-ARM-Translation_v1.1.zip onto the Genymotion VM window. It should say "File transfer in progress", once it asks you to flash it click 'OK'. When finish restart VM.
Once you're on the Homescreen again drag&drop the gapps-5.1-2015-04-20-15-56-24.zip (or whatever version you got) onto your VM, and click 'OK' when asked. Once it finishes, again Reboot your VM.
Now you can add your Google account in settings. After that you can use google services for apps that you have installed like Calendar.
An image of my virtual device with google acount working:
http://i.stack.imgur.com/4tQdK.png
Hope this helps!
Related
I want to apply HMS to my app. However, buying an actual Huawei phone is not on my shortlist. Does Huawei provide an Android Virtual Device for that purpose? If not, how to test if my implementation of HMS actually works?
Yes, Huawei do provide an Android Virtual Device called Cloud Debugging of AppGallery Connect to test your app for Huawei Devices.
Cloud Debugging tests your app using mainstream Huawei devices provided by Huawei. You can run your app on the latest and most popular Huawei devices to test app functions. Besides, you can debug apps on two real devices at the same time using one HUAWEI ID. Assume that you have applied for a device successfully.
Work with Cloud Debugging
Sign in to AppGallery Connect and select My projects.
Select an app to be tested.
Go to Quality > Cloud Debugging.
Filter devices by Series, Android version, EMUI version, and Resolution.
In the Apply for device model dialog box that is displayed, set Debug duration based on your needs. The options are 30 min, 1 h, and 2 h.
Wait for the device initialization to finish.
Click the Debugging tab.
Click Upload to upload an APK.
Check the APK upload progress and install the APK after the upload is complete.
In the displayed dialog box indicating that the app is being installed, click OK. When the installation is complete, you can see the app icon on the device screen on the left.
Operate the device by moving or clicking your cursor on the device screen, or clicking the power button, home button, menu button, or back button. The device will respond like your own phone.
Check Screenshot below:
From: https://stackoverflow.com/a/63389096/13329100
If you don't have HMS device your side you can run HMS Application in three ways.
1. Huawei Cloud Debugging in App Gallery: In this method first we have to sign in App Gallery. You can see the article "Efficient integration of HMS open capabilities by using HUAWEI Cloud Debugging solution" for the step by step process of cloud debugging.
2. Cloud debugging through HMS ToolKit: Here first we have to install HMS Tool Kit plugin in Android Studio.You can use the article "Debug your application on any HMS Supported Model using HMS Toolkit Cloud Debugger - No Real Device Required" for step by step process.
3. Installing HMS Core App in your non HMS Device: You can install HMS Core app in your non HMS device. Once install it will ask to update the app. This will help you to run some Kits like awareness, ML, Ad etc in your device. Once we install we have to go to Settings->Apps and search for 'HMS Core'and grant the location or other permissions which are required.
Hope any of these method will help you.
I would like to know if there is any effective way to test an app for Huawei Store using an Android Studio emulator.
I tried disabling the Google Play Services, but for some reason Retrofit requests stopped working :/
You can use Cloud Debugging of AppGallery Connect to test your app for Huawei Devices.
Cloud Debugging tests your app using mainstream Huawei devices provided by Huawei. You can run your app on the latest and most popular Huawei devices to test app functions.
Work with Cloud Debugging
Sign in to AppGallery Connect and select My projects.
Select an app to be tested.
Go to Quality > Cloud Debugging.
Filter devices by Series, Android version, EMUI version, and Resolution.
In the Apply for device model dialog box that is displayed, set Debug duration based on your needs. The options are 30 min, 1 h, and 2 h.
Wait for the device initialization to finish.
Click the Debugging tab.
Click Upload to upload an APK.
Check the APK upload progress and install the APK after the upload is complete.
In the displayed dialog box indicating that the app is being installed, click OK. When the installation is complete, you can see the app icon on the device screen on the left.
Operate the device by moving or clicking your cursor on the device screen, or clicking the power button, home button, menu button, or back button. The device will respond like your own phone.
Check Screenshot below:
You can check out the official documentation for a more complete answer.
For most cases, you can simply grab HMS Core APK and install it on emulator or physical device
You do not need for most cases Huawei device. Here is my battle-tested solution.
If you're implementing HMS (Huawei Mobile Services) feature like push notifications, sms retrieving or auth(orization) you can do simply:
Grab HMS Core APK from: https://www.huaweicentral.com/download-the-latest-huawei-mobile-services-apk/
Create new or run existing Android emulator via Android Studio or ADB
Install HMS Core APK downloaded from 1.
Go to Settings -> Apps & Notifications
Make sure that HMS Core has required permissions like SMS for SMS retrieving or push notifications
If you forget about 5., HMS library will return exception "Permissions not enabled"
I am pretty sure that instead of emulator you can use any of physical devices, grab APK and install HMS Core on it.
From: https://stackoverflow.com/a/63790263/4730812
Happy coding!
Well, I was trying here to make Retrofit work in this condition and I found a way.
I don't know if it is the best solution, but I will post it anyway.
disable the Google Play Services;
force stop your app;
restart the emulator;
check if it is working now (if not, try to force stop your app again).
P.S.: Google Play Services is not re-enabled upon reboot.
I am playing around with the BasicManagedProfile sample and want to install a custom app to only the managed profile. I can easily go to the play store, download, and install an app and it will only appear in the apps of the work profile.
However, using the standard Intent way to install an apk from the device does not seem to work.
final Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
intent.setDataAndType(Uri.fromFile(new File(APK_LOC)), "application/vnd.android.package-archive");
intent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true);
intent.putExtra(Intent.EXTRA_INSTALLER_PACKAGE_NAME, getPackageName());
startActivityForResult(intent, REQUEST_INSTALL, null);
Like normal, if the "Install from unknown sources" security setting isn't enabled, a dialog will pop up that sends you to the Settings app to enable it. However, in a managed profile app, this dialog always pops up regardless of whether or not that security setting is checked. It seems the settings are not reflected in a managed profile (which makes sense because it's an entirely separate settings database).
I have tried opening the Settings app directly, but it's still the same. It just goes to the standards Settings app and not a Managed Profile settings app.
Is there a way to change this security setting for a managed profile or install an app from the profile owner app? Since my app is the profile owner it seems this should be allowed. It's easily possible for system applications, but third party apps will not work with the DevicePolicyManager#enableSystemApp() method.
EDIT:
I have also tried installing from a Manage Profile Gmail app. Same thing. It does not seem possible to install apps outside the Google Play store in a managed profile.
Google has restricted the direct installation of .apk files in the managed profile.
The unusual behavior of the alert box saying the user to go to settings and enable the "install from unknown sources" even though it is enable is considered as an issue. See the Google issues page here .
Is there a way to change this security setting for a managed profile
or install an app from the profile owner app?
Currently there is no API or work arounds to install an .apk file in the managed profile. But for testing you can try through adb
adb install appname.apk
This command would install the application in both the personal and the managed profile. Hope this helps you!
Go to edit the configuration in Android Studio as shown below in the image and then click check Install for all users to install app for Work Profile and Normal Admin similarly uncheck for Normal install.
I would like to reopen this question since I am having the same problem:
Use Calendar within emulator Android 4.0 +
Namely, I see a Calendar application on virtual devices running android 4.0
or later (there is no calendar application on android 3.2 even though my physical
gingerbread phone has once such an app, which I find strange). However I am not
able to synchronize the data on the android 4.0 or later emulator with my google
account's calendar data. Here are the details:
I had created an Android 4.2.2 emulator and launched the calendar application
from within such an emulator. I want to sync my google account with the calendar
application. So I hit menu -> Settings -> ADD ACCOUNT. Nothing happens. So I tried
to hit menu -> Calendars to display -> Calendars to sync, but the list is empty
and hitting menu does not bring up a menu.
I suspected the problem was I needed google apis to work. So I created a new
4.2.2 virtual device with google apis. When I launched such emulator and then the
calendar application I got a screen saying "Make it Google", "Do you want to add
an existing account or create a new one?". Click on Existing. I entered my
sign in details. I click on the popup asking me to agree to google terms
of service, and I accepted. It then says "Signing in..." "This can take a few minutes."
The Backup and Restore screen shows up and I click forward and proceed. However I
do not see the contents of my google calendar's account on the android calendar.
When I launch the calendar application again it asks me once again to
"Make it Google" and enter my account information. If I enter the old
information it complains telling me I have already specified such an
account. However my google account's data does not show up in android calendar.
I cannot understand why or what I am doing wrong.
(Alas I do not have a 4.0+ phone to test with so I am stuck having to get
the emulator to work).
Thanks for your feedback,
Jason Posit
I know this is older, but I did find a solution. I was never able to get a Google account to work since Google blocks active sync on free accounts.
The solution for me was to signup for a free outlook.com account and use outlook.com's active sync settings.
The steps I followed are from my blog and are as follows:
Sign out for free account at outlook.com
Select a Corporate Account
Enter username such as email#outlook.com
Select Manual Setup
Select account type of “Exchange” (This will allow us to sync with active
sync)
Enter Server as s.outlook.com
Security type as SSL/TLS
Select next
Confirm settings.
As "Corporate Account" type isn't being provided in newer emulator images, one can install custom CalDAV adapter, which amusingly does work with Google's CalDAV interface.
I want to know, is there a way for the end user to know through UI, following information for any application installed on the Android platform:
App installed date
App Version
Installed date of the update of the App
App Version for the Update of the app
Thanks and Regards,
Venkat
You can follow these steps:
1) open the google play store
2) view your apps in the google play store (sorry this one steps not too specific)
3) click on the "installed" tab so it shows your installed apps
4) click the filter button and select to sort them by date of last update!! :)
Through UI, the installed date cannot be known.
Yes, it is visible if the user navigates from Home -> Settings -> Applications -> Manage Applications -> Application Name from below image
The updated date of the App cannot be known
The Version can be known as Point 2.