Firstly, I already have an application written (according to spec). It scans a QR Code, then shows two buttons (Select Images and Select Video). Using Crossmedia it allows the user to pick pictures (or video) and then loads the data into an internal SQLite database. Periodically a routine picks each entry in the database and uploads it via Power Automate which then creates an entry in a table in Dynamics 365 which has another flow that is fired on a create of a record in Dynamics 365, processes the data to find which order the picture belongs to and inserts the picture into CRM Sharepoint. All the above works perfectly and is to spec......... However!
The app needs to be changed to do the following;
- When the QRcode has been scanned, launch the default camera application (iOS & Android) but take a timestamp and store it in app.
- The user will take lots of pictures and video's
- When the user minimises/backgrounds the camera, the original app will redisplay (one would hope).
- The user presses a button marked Finish.
- The app records the 'end' timestamp.
- Via magic (Haven't worked out how to do this as yet), a list of all videos/pictures that were created between the two timestamps would be retrieved, all the data content of the videos/pictures would be obtained, and the data dumped into the SQLite database whereupon the upload bit would run (in background).
I have a chunk of code in the top-level solution that reacts to a button to start the camera - this fails magnificently with
Android.Content.ActivityNotFoundException Message=No Activity found to handle Intent { act=android.intent.action.VIEW dat=Camera:// flg=0x14001000 }
Device.BeginInvokeOnMainThread(() =>
{
/*
Launcher.OpenAsync(new Uri("Android.Hardware.Camera://"));
*/
Launcher.OpenAsync("Camera://");
});
I have tried different URIs such as Camera:// camera:// Android.Hardware.Camera:// but I always get the same level of indifference!
My manifest for Android is:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.app2">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="31" />
<application android:label="App2.Android" android:theme="@style/MainTheme"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.INTERNET" />
<permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<permission android:name="android.permission.CAMERA" />
<permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<queries>
<intent>
<action android:name="android.media.action.VIDEO_CAPTURE" />
</intent>
<intent>
<action android:name="android.media.action.IMAGE_CAPTURE" />
</intent>
</queries>
</manifest>
How can I launch the inbuilt camera app - which is the first issue I need to resolve?