Xamarin iOS Fails Calling DataServiceQuery - xcode

Just coming back to testing the iOS cross platform project of my solution today, I am receiving the error message "An error occured on client IDB4110776 while executing a reply for topic xvs/idb/4.11.0.776/stop-app" when trying to iterate the results of a DataServiceQuery, i.e.
foreach (IdentityEntitiesModel.Device device in response.EndExecute(result))
In general, looking at the response received, it looks basically ok, having the query path. It was working two months ago.
I am using Xcode 10.1 beta 2 (10O35n) against a iPhone with iOS 12.0 (16A366) from VS2017 15.8.5. Another developer just encountered the same error using Xcode 10 and IOS 10.14.1.
Where might I find details as to the "xvs/idb/4.11.0.776/stop-app" function?

It appears that iOS requires the call be marshalled to the main thread, i.e.
Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
{
try
{
foreach (IdentityEntitiesModel.Device device in response.EndExecute(result))
{
if (device.MAC == DeviceID)
{
activeDevice = device;
activeICID = device.ICID;
// Remark to debug new device
DeviceFound = true;
}
}
}
catch (DataServiceQueryException ex)
{
string error = ex.Message.ToString() + cr;
}
});
The solution should work across platforms.

Related

Properly implement In-App Updates in App Center?

I am reading this documentation/article from Microsoft on how to Distribute Mobile apps with app center. The problem is I really don't understand how to implement this. I have a app on app center (Android) I want to implement mandatory update so that I can eliminate the bugs of the previous version. I tried to distribute the app with mandatory update enabled and it is not working. How can I fix this?
https://learn.microsoft.com/en-us/appcenter/distribution/
Here is what I did I added this code on my App.xaml.cs (XAMARIN FORMS PROJECT):
protected override void OnStart ()
{
AppCenter.Start("android={Secret Code};", typeof(Analytics), typeof(Crashes), typeof(Distribute));
Analytics.SetEnabledAsync(true);
Distribute.SetEnabledAsync(true);
Distribute.ReleaseAvailable = OnReleaseAvailable;
}
bool OnReleaseAvailable(ReleaseDetails releaseDetails)
{
string versionName = releaseDetails.ShortVersion;
string versionCodeOrBuildNumber = releaseDetails.Version;
string releaseNotes = releaseDetails.ReleaseNotes;
Uri releaseNotesUrl = releaseDetails.ReleaseNotesUrl;
var title = "Version " + versionName + " available!";
Task answer;
if (releaseDetails.MandatoryUpdate)
{
answer = Current.MainPage.DisplayAlert(title, releaseNotes, "Download and Install");
}
else
{
answer = Current.MainPage.DisplayAlert(title, releaseNotes, "Download and Install", "Ask Later");
}
answer.ContinueWith((task) =>
{
if (releaseDetails.MandatoryUpdate || (task as Task<bool>).Result)
{
Distribute.NotifyUpdateAction(UpdateAction.Update);
}
else
{
Distribute.NotifyUpdateAction(UpdateAction.Postpone);
}
});
return true;
}
And here is what I added on my MainActivity.cs(ANDROID PROJECT):
AppCenter.Start("{Secret Code}", typeof(Analytics), typeof(Crashes), typeof(Distribute));
Looking at this App Center documentation here for Xamarin Forms -
You can customize the default update dialog's appearance by implementing the ReleaseAvailable callback. You need to register the callback before calling AppCenter.Start
It looks like you need to swap your current ordering to get in-app updates working.
There could be a lot of different reasons as to why they are not working. As you can see in the Notes here and here,
Did your testers download the app from the default browser?
Are cookies enabled for the browser in their settings?
Another important point you'll read in the links, is that the feature is only available for listed distribution group users. It is not for all your members. You could use a simple version checker for your purpose instead or you could use a plugin.

Unique ID for mobile device FMX

What is a good way to create a unique ID for mobile devices (iOS and Android) in a C++Builder FMX app?
In my case, I just want to let my app users vote, but only once per device (even if they delete the app and reinstall it). They stay anonymous, but just can't vote more than once.
I know Apple came out with DeviceCheck for Swift, but I don't know how to use it in C++.
iOS 11: The DeviceCheck API
DeviceCheck API - Unique Identifier for the iOS Devices
Update: This solution targets Android devices. I have no experience with iOS devices.
Original answer: It may be way too late but here's my solution using _di_JTelephonyManager
_di_JObject obj;
_di_JTelephonyManager tm;
UnicodeString id;
try {
obj = SharedActivityContext()->getSystemService(TJContext::JavaClass>TELEPHONY_SERVICE);
if (obj) {
tm = TJTelephonyManager::Wrap(static_cast<_di_ILocalObject>(obj)->GetObjectID());
if (tm) {
//only if SIM Card is in device:
//id = JStringToString(tm->getSubscriberId());
//will get IMEI or MEID number
id = JStringToString(TJSettings_Secure::JavaClass->getString
(SharedActivity()->getContentResolver(),
TJSettings_Secure::JavaClass->ANDROID_ID));
}
}
}
catch (Exception &e) {
//catch exceptions
}
Hope it is helpful :)

Firefox Native Messaging runtime.LastError not giving any errors in case of no Native application installed on Connectnative

I am trying to check whether the Native app is installed or not , If it is not I have to prompt the user to download it from the webpage. For chrome I used to achieve by checking the error messages from runtime.LastError. However in case of Firefox it gives error only in console No such native application extension_name and not catching it in the runtime.LastError method.
Is there any way that we can identify whether corresponding Native app is installed or not ?
I am facing issue when Native app is not installed and browser.runtime.lastError is not giving any error.
Can you please suggest if there is any way in Firefox Webextension that we can catch such errors and identify it in code whether the corresponding Native app is installed or not on the user machine.
It will really helpful if someone can provide some info on this.
for e.g. :
startNativeApp: function(force){
// note that when the native app is opened and ready, it will call "_ABC_onAgentReady"
ABC.log('Starting native app.');
if (!ABC.appConnected) {
try {
ABC.nativeAppPort = browser.runtime.connectNative(_ABC_native_app_id);
ABC.nativeAppPort.onMessage.addListener(ABC.onNativeMessageReceived);
ABC.nativeAppPort.onDisconnect.addListener(ABC.onNativeAppDisconnected);
ABC.appInstalled = true;
ABC.appConnected = true;
} catch(e) {
ABC.log('Error starting native app: ' + e.message, 'ERR');
}
} else if (force === true) {
ABC.log('Native app is already running; attempting to stop and will restart in 750ms.');
ABC.stopNativeApp();
setTimeout(function() { ABC.startNativeApp(true); }, 750);
}
},
onNativeAppDisconnected: function(message) {
console.log("ABC LastError : "+browser.runtime.lastError);
console.log("ABC LastError : "+ABC.nativeAppPort.error);
console.log("ABC LastError : "+JSON.stringify(message));
ABC.appConnected = false;
ABC.nativeAppPort = null;
ABC.appInstalled = false;
if (browser.runtime.lastError && (browser.runtime.lastError.message.indexOf("No such native application") !== -1 )) {
ABC.appInstalled = false;
}
// cleanup: reset the sig data so that it is re-requested on the next scan
_ABC_sa_data = "";
_ABC_sigs = "";
if (browser.storage && browser.storage.local) {
browser.storage.local.set({ uid: _ABC_be_uid }, null);
}
ABC.log('Send message to page to stop.');
ABC.sendMessageToPage({ onNativeAppDisconnected: '' });
ABC.log('Native app disconnected.');
},
Issue here was that port.error was not giving any error response in Firefox versions less than 52 , Due to which I was facing problem in identifying whether native app is installed or not.
After discussion on Mozilla Community (https://discourse.mozilla-community.org/t/firefox-native-messaging-runtime-lasterror-not-giving-any-errors-in-case-of-no-native-application-installed-on-connectnative/12880/4) , we found that it is actually missed and a bug is already reported : https://bugzilla.mozilla.org/show_bug.cgi?id=12994116
which will be resolved in Firefox 52.
However , I need to support Firefox 50 also , so the alternate I am using is to call native application in starting to find out whether it is installed or not.
If I got back response than it is installed otherwise it is not.
However specific error messages will be available from Firefox52.
Right now at chrome 109 the following approaches won't work after connectNative:
chrome.runtime.lastError. The error is printed because it is visible in the log but right after the call it is undefined.
console.error = function (arg) {/**/}. Is not working to replace the default function.
port.name is "" in both cases (error or no error).
port.onDisconnect is not called if the application is missing.
The only solution left is to call a third checker:
const promise=chrome.runtime.sendNativeMessage("appname", { /*text: ""*/ });//,check_response
promise.then(check_response,check_error);
In Firefox there is no runtime.lastError.
The listener function you pass to runtime.Port.onDisconnect isn't passed the message, it's passed the port itself.
You then want port.error.
See the documentation for onDisconnect here https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/runtime/Port

cordova record audio not work windows 10 mobile

I work for some time with the media cordova plugin on android and ios mobile on to record audio files. It works well. However on windows, while recording no error occurred, but no file exists. Just when the application goes into background and we return it, an error with code like 2147483648 (I have not found any information relevant to my problem with this code).
function recordAudio() {
var src = "ms-appdata:///temp/sound.m4a";;
var mediaRec = new Media(src,
// success callback
function() {
console.log("recordAudio():Audio Success");
},
// error callback
function(err) {
console.log("recordAudio():Audio Error: "+ err.code);
});
// Record audio
mediaRec.startRecord();
}
I can not find solutions or similar problems. The rest github does not included the problems.
In MediaProxy.js (plugins/cordova-plugin-media/mediaProxy.js)
There is this constant:
var PARAMETER_IS_INCORRECT = -2147024809;
Is this the error you are getting? If so, this only seems to be used in one place, if there is no scheme for the path. Take a look at setTemporaryFsByDefault() in that same file.

Facebook sdk for Unity: error

As facebook just released it's new sdk for Unity. I m trying to use FB.API method and getting a lot of troubles with it. Like this is code I have written in UnityScript in my Unity project.
function LoginCallback() {
Debug.Log("User id is"+ FB.UserId);
FB.API("/me?fields=id,first_name,friends.limit(100).fields(first_name,id)", Facebook.HttpMethod.GET, LogCallback, null);
FBUtil.Log(FB.UserId); // Use this to sync progress, etc.
}
function LogCallback(response:String) {
// Debug.Log(response);
var profile = FBUtil.DeserializeJSONProfile(response);
var friends = FBUtil.DeserializeJSONFriends(response);
}
I am getting this error in Unity Log
BCE0005: Unknown identifier: 'FBUtil'.
And if I comment out the FBUtil part and just try to print the json string by writing this
function LoginCallback() {
Debug.Log("User id is"+ FB.UserId);
FB.API("/me?fields=id,first_name,friends.limit(100).fields(first_name,id)", Facebook.HttpMethod.GET, LogCallback, null);
}
function LogCallback(response:String) {
Debug.Log(response);
}
I am able to get Fb.UserId but I am not getting the response with the following details like first_name, friends. The error in DDMS Log is this
"09-04 21:35:04.534: E/Unity(23893): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 54)
"
Someone help me out.

Resources