turn off android camera in flashcs6 adobe air - java

Hi guys
i need turn off camera in android app created by adobe air 3 in flash cs6 .
i used this code for turn off camera :
videoDetect.attachCamera(null);
videoCapture.attachCamera(null);
but when run in my device , error :
An error has occurred in sub: settingm_camera1_ready
(java line: 464)
java.lang.IllegalStateException:The specified child already has a parent.you must call removeView() on the child s parent first.
plz help .
tanx

try the following:
video.attachCamera(null);
video.clear();
removeChild(_video);
camera = null;

Related

Read custom Information Elements from WiFi Beacon on Android 12

please, I am working on new app, which should read Information Elements from WiFi beacon in scan. I have Android 12 and using something like this:
ScanResult r = results.get(i);
List<ScanResult.InformationElement> ie = getWiFiInformationElement(r);
I see in the ie array. There is SSID and more, but I don't see my extra IE item with data from my device with ID 0xDD. I checked by another device, and my extra IE is visible on the air, but not visible by my Android phone with my app.
Please, could you help me?

Public Storage Folder API 30 Android 11

Android 11,
I'm trying to create a publicly accessible folder I can store my media files within, which will contain 1 folder and 1 text file per game type (there could be many), I do not want any other application to have access to the root folder for the exception of file explorers, as the user 'could' have content inside the folder that is R18 restricted or might not, I'm not in control of what content goes in there, it would be nice if I could provide that so that a child doesn't in mistakenly bump into the content while looking for pictures on the device for barnie.
I found some code on GitHub that did just the above on Android 10 and works flawlessly for Android 10, but cannot find anything but blue pills about it when it comes to Android 11, help in the form of example code would be great, yes I know targeting only Android 11 limits me but I'd rather live with the limit than play with many different versions of code.
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE).apply {
flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or
Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION
}
startActivityForResult(intent, OPEN_FOLDER_REQUEST_CODE)
EDIT 2
After some hacking around, because 'startActivityForResult(Intent!, Int): Unit' is deprecated. Deprecated in Java, I end up with this, results is a URI, can I now use this to pass files to other API calls now?
pref = getSharedPreferences("myPref", Context.MODE_PRIVATE)
var userFolderData: String? = pref.getString("userFolderData", "")
if (userFolderData=="") {
val getUserFolderData =
registerForActivityResult(ActivityResultContracts.OpenDocumentTree()) {
mytools.debug(it.toString())
pref.edit().putString("userFolderData",it.toString()).apply()
userFolderData = it.toString()
}
getUserFolderData.launch("".toUri())
}
mytools.debug("userFolderData = ${userFolderData}")
EDIT 3
So I ran a test on the URI returned; always the same story not matter what I do, yes that's pretty ugly hack but it's the easiest way I can find to test it.
ivtitleimage.setImageURI("content://com.android.externalstorage.documents/document/primary%3ATest%2FMelsDeck%2Fbendover01.jpg".toUri())
31833-31833/com.example.cardgamexxx E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.cardgamexxx, PID: 31833
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.cardgamexxx/com.example.cardgamexxx.MainActivity}: java.lang.SecurityException: Permission Denial: opening provider com.android.externalstorage.ExternalStorageProvider from ProcessRecord{5a390cf 31833:com.example.cardgamexxx/u0a741} (pid=31833, uid=10741) requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs
EDIT 4
Right, so user selects folder/creates one with registerForActivityResult code above, I place files in it with Cx File Explorer and automagically drum roll! ...
I do not have read access to the file placed there, anyway thought I'd comment here as I don't want people stumbling on the post and thinking this works, because it doesn't.
On an Android 11 device your app can only create folders on root of external storage in the classic way if it has requested 'all files acces'.
Or it can use Storage Access Framework and for instance ACTION_OPEN_DOCUMENT_TREE to let the user create a folder in root of external storage and then select it.

turning on off flash light while open camera android?

i am using CameraView api 'com.otaliastudios:cameraview:2.6.4' for camera live preview , i want to turn on camera and according to document i can do it with CameraView by turning on but it does not works .
i tried to do it with CameraManager but it is not working either giving me exception that i can not use Flash light when camera is in use . i found some other similar question on stackoverflow . they seem to work but code is not making sense to me , i am not able to understand the code because code is not full .
do you have idea how can i do this , i have already defined permission AndroidManifest file for FLASHLIGHT and CAMERA .
Thank You In Advance .
I am facing the same issue. Try this solution, or read this blog: CameraX: Learn how to use CameraController
val cameraInstance : Camera = cameraProvider?.bindToLifecycle(viewLifecycleOwner, cameraSelector, previewUseCase)
private fun flashToggle() {
// My toggle flash function
val cameraController = cameraInstance?.cameraControl
if (cameraInstance?.cameraInfo?.torchState?.value == TorchState.ON) {
cameraController?.enableTorch(false)
binding.barscanfFlashToggle.setImageResource(R.drawable.ic_baseline_flash_off_24)
} else {
binding.barscanfFlashToggle.setImageResource(R.drawable.ic_baseline_flash_on_24)
cameraController?.enableTorch(false)
}
}

THE JMF REGISTRY CANNOT CAPTURE PC CAM DEVICE 2..1.1E

i HAVE STARTED A NEW video STREAM PROJECT USING java LANGUAGE .I will put you in the scope of my two questions but keep know now that I will ask you about vedio capturing and detection ,not sending videos .
1-I have downloaded the jmf studio and registry . the problem in the jmf regestry .jfm registry cannot detect my pc cam .how can i detect it, or as i read in other words , where the jmf.properties can be put to run the registry well.
2- as i go forward to write the java code , i used this code to detect the cam:
Vector<CaptureDeviceInfo> list = CaptureDeviceManager.getDeviceList ( new
YUVFormat() );
// Iterating list
for(CaptureDeviceInfo temp : list){
// Checking whether the current device supports VfW
// VfW = Video for Windows
if(temp.getName().startsWith("vfw:")){
System.out.println("Found :
"+temp.getName().substring(4));// Selecting the very first device that supports VfW
cam = temp;
System.out.println("Selected :
"+cam.getName().substring(4));
break;
}
}
System.out.println("Put it on work!...");
// Getting the MediaLocator for Selected device.
// MediaLocator describes the location of media content
locator = cam.getLocator();///
this is just a snap shot, look now ,as no device can be detected the locator stay null, now my question is there a realation between the jmf registry and in general any project that will use this function to detect devices. sorry for this long question .
note : as i try all the answers of this question which i have founded on the stack overflow or others with no success , i have been forced to ask it a gain .

Invalid unknown request error: Cannot determine request type. Is this ad unit id correct?

After updating to "new abMob", it appears to have this problem...
use this code, but nothing displays:
adView = new AdView(this, AdSize.BANNER, "pub-xxxxxxxxxxxxxxxx");
and got warning:
Invalid unknown request error: Cannot determine request type. Is your
ad unit id correct?
What's wrong?
Using android emulator, admob 6.4.1
In my case, the ad unit id was incorrect in AdMob app management section! There was a ~ instead of / in the id. I fixed it by viewing the GoogleService info plist and found the correct unit id.
Change:
ca-app-pub-XXXXXXXXXX~XXXXXXXXXX
to:
ca-app-pub-XXXXXXXXXX/XXXXXXXXXX
The adUnit Ids in the new Admob console are of the form:
ca-app-pub-XXXXXXXXXXXXXXXX/YYYYYYYYYY
This is what your problem is.
Go check your Admob console and update your app to reflect that.
First you have to go to www.admob.com. There sign in with your account. Then klick at "Monetize" next to "Home". There you have to add your app and set the settings for your advertisement. After that, the website is asking you to send you an e-mail with your ad unit id, you have to put in your strings.xml file instead of the exsample id. Hope this helps.
#if UNITY_ANDROID
string adUnitId = " ca-app-pub-8572140050384888/1853336688 "; //no spaces are allowed before and after admob-id..
Change to :
#if UNITY_ANDROID
string adUnitId = "ca-app-pub-8572140050384888/1853336688";
android java admobunity
You don't need to have an app already on the market to get a Publisher ID for a new app. In the Android Package URL field that's on the "Add Site/App" form, just enter "market://details?id=your.package.name". You'll of course want to replace the 'your.package.name' with your app's actual package name.
The viewWidth warnings are fine and you will likely still see them after inserting your Publisher ID.
Refer below links..
How to get Google's example code working for AdMob 4.1.0 using an Android device
AdMob 4.3.1 adds not showing up (No AdMob ID yet (just for test), can't get ViewWidth)
Try this format
GADBannerView * bannerView_;
bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
bannerView_.adUnitID=#"ca-app-pub-5250422073333775/6825580043"; //Id for Top Banners
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];
[bannerView_ loadRequest:[GADRequest request]];

Categories

Resources