When I open a link from a barcode reader that calls an action on my site the controller is called twice and the session data is reset on the second call.
If I open a browser and paste the same URL directly into it, then the controller is only called once. If I follow the same link from an email the controller is only called once.
This is happening in Firefox, Chrome, and Safari on Android and iPhone. Any clues to why opening the browser from a link would force my website to load twice?
Edit: I've tried multiple barcode readers on iPhone and Android with the same result, the page loads twice even if it is stripped down. However, it is not happening in email links as originally stated. The email links went to a different page with a different problem, when directed to the same page as the barcode scan they do not load twice. I have corrected the info above to reflect this.
Edit 2: Here are the logs from my server for an iPad following a link in a barcode scanner. Note that the first two logs are the same except the last digit.
2016-01-29 13:19:34 69.94.136.16 GET /MyPage/ABCDEF - 80 - 24.62.217.163 Mozilla/5.0+(iPad;+CPU+OS+9_2+like+Mac+OS+X)+AppleWebKit/601.1.46+(KHTML,+like+Gecko)+Mobile/13C75 - 200 0 0 93
2016-01-29 13:19:34 69.94.136.16 GET /MyPage/ABCDEF - 80 - 24.62.217.163 Mozilla/5.0+(iPad;+CPU+OS+9_2+like+Mac+OS+X)+AppleWebKit/601.1.46+(KHTML,+like+Gecko)+Mobile/13C75 - 200 0 0 109
2016-01-29 13:19:34 69.94.136.16 GET /Scripts/jquery-2.1.1.min.js - 80 - 24.62.217.163 Mozilla/5.0+(iPad;+CPU+OS+9_2+like+Mac+OS+X)+AppleWebKit/601.1.46+(KHTML,+like+Gecko)+Mobile/13C75 http://example.com/MyPage/ABCDEF 200 0 0 328
Edit 3: Here is a fairly typical version for Android from the logs:
2016-01-29 13:14:28 69.94.136.16 GET /MyPage/ABCDEF - 80 - 77.234.44.145 ZXing+(Android) - 200 0 0 125
2016-01-29 13:14:47 69.94.136.16 GET /MyPage/ABCDEF - 80 - 77.234.44.145 Mozilla/5.0+(Linux;+Android+5.1.1;+VS985+4G+Build/LMY47V)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/47.0.2526.83+Mobile+Safari/537.36 - 200 0 0 109
I found the problem for anyone else who comes here seeking. It turns out the barcode readers are calling GET so they can get the page and show its title to the user (and perhaps they get it for other reasons as well).
So, the page gets called by the reader and by the user when he follows the link. That is why a page with no images or missing links gets loaded twice from a barcode reader.
First check references on your page, maybe they are doing second request - for example if you have css or script reference with empty path. The easiest way to test that is to setup one simple view just with "Helloo" text, and try open that from link or android app.
Related
I have a NativeContentAdView in a ListView item. When I call setNativeAd(NativeAd) on it, a noticeable lag happens. All AdMob class and method names are mangled (zzdt, zzalp, zzow etc) so I omit them.
Things AdMob performs in View#onAttachedToWindow callback:
registers several BroadcastReceivers (each requires a Binder transaction) (sum ~10 ms)
Things AdMob performs in OnScrollChangedListener#onScrollChanged:
dozens of DP-to-PX conversions, calling Display#getMetrics and triggering a Binder transaction for each conversion (sum ~7 ms)
generates some JSON (~8 ms)
evaluates some JS (~7 ms)
creates a WebView instance (~5.5 ms), sets it up (~9 ms), asks it to loadUrl (~7.5 ms)
Inside Handler#handleCallbacks (i. e. Handler#post):
Creates a WebView, sets it up, adds to Window and evaluates JS (~27 ms)
Gets packageInfo (IPC), creates a WebView, sets it up, asks to loadUrl, checks permissions (IPC), parses JSON, gets packageInfo one more time, introspects resources via Resources#getIdentifier, gets activityInfo (IPC) (sum ~40 ms)
Obviously, all these heavyweight operations are leading to jerky scroll.
What should I do to avoid lags or what I'm possibly doing wrong? Why don't AdMob native AD is as slow in other applications I've seen?
Using AdMob/GMS v. 10 and/or 11, but 16 shows the same lags.
All measurements are taken with Nanoscope on their special emulator, but lag on a real not-so-old Nexus 5 is even worse.
I have successfully written some data on data pages 30 to 38.
After that I want to lock those pages in order to prevent further writing. The write lock should be permanent, so even if someone knows the authentication key, they should not be able to write to those pages.
As far as I have understood the datasheet, I have to write some bits on OTP pages. But I do not fully understand what command I have to send for locking specifically pages 30 to 38.
Can somebody help me in identifying the command that needs to be sent to the card? My thinking is that I have to write F0 on page 40. However, this might also make pages 28, 29 and 39 locked and, hence, unusable.
How to permanently lock pages 30 to 38?
In order to set the lock-bits that include pages 30 to 38, you would need to set the lock-bits that are located in bits 5, 6, and 7 of byte 0 of page 40. You can do this with the WRITE command. For lock bits (or any OTP pages) this command will only program those bits that are set to '1' in the data parameter of the command (essentially resulting into a logical OR). Note that the WRITE command always takes one full page (i.e. 4 bytes) as its data parameter:
byte[] result = nfcA.transceive(new byte[] {
(byte)0xA2, /* CMD = WRITE */
(byte)0x28, /* PAGE = 40 */
(byte)0xE0, (byte)0x00, (byte)0x00, (byte)0x00 /* DATA = lock pages 28..39 */
});
But hey, I did not want to lock pages 28, 29, and 39! How can I only lock pages 30 to 38?
Unfortunately, you can't! The locking mechanism of MIFARE Ultralight C for pages 16 to 39 is organized in blocks of 4 pages. Hence, you can only lock the following groups of 4 pages:
Pages 16..19
Pages 20..23
Pages 24..27
Pages 28..31
Pages 32..35
Pages 36..39
What does the block locking bit do?
The block locking bit sets the write protection for bits within the lock page. So for instance if the block locking bit for pages 28 to 39 is set to '1', this means that you cannot change the state of the three lock-bits for these pages. Hence, if you set the lock-bit for pages 28 to 31 but leave the lock-bits for pages 32 to 35 and 36 to 39 unset, and then set the block locking bit, you can no longer activate the write protection for pages 32 to 39.
-- hide device status bar
display.setStatusBar( display.HiddenStatusBar )
-- require controller module
local composer = require( "composer" )
-- load first scene
local scrOptions =
{
effect = "fromRight",
time = 2000
}
composer.gotoScene( "game", scrOptions )
--
-- Display objects added below will not respond to storyboard transitions
local MemUsageDisplay = display.newText( "0", 400, 25, native.systemFont, 20 )
MemUsageDisplay:setFillColor( gray )
local monitorMem = function()
local textMem = system.getInfo( "textureMemoryUsed" ) / 1000000
collectgarbage()
local date = os.date( "*t" )
MemUsageDisplay.text = date.hour .. ":" .. date.min .. ":" .. date.sec .. " / Lua: " .. math.round(collectgarbage("count")) .. "K " .. "Tex: " .. math.round(textMem*10) * 0.1 .. "MB"
end
timer.performWithDelay( 500, monitorMem, 0 )
In the simulator everything is fine.
On the device however the splashscreen flashes for less than a second, then the screen goes black for about 5 seconds, and then the game starts.
There is no transition.
I have to add that my game.lua contains a lot of code, but if I understand the docs correctly, all of that should be processed while the splashscreen is visible? I also ran the app while watching it in debugging mode (catlog...) and put some markers in it to see how fast the code executes. The whole game.lua is processed in less than a second.
Is this normal behavior?
What is the parameter required for composer.gotoScene( "game", scrOptions )?
You need to figure it out in composer library.
have you decrease the time and change the effect in your scrOptions array?
Just try this and let me know what are you getting.
So i can do the further investigation.
It sounds like to me that you are not creating your scene in the scene:create() event function but in the scene:show() event function. Your transition is set for 2 seconds and if you are not creating anything in scene:create() then there won't be anything to transition, but the transition will still take place, ergo going black for a couple of seconds.
Rob
Add this code
local scene = composer.newScene()
If everything is working fine in simulator, that means please check in your code whether your using the proper file name (i.e image name and scene names are correct) since simulator will take Image.png and image.png as same, but in device it will show error.
I am writing network communication program with Android ndk, using epoll.
I found the method ‘epoll_wait’ woken not very accurate
while(1){
struct epoll_event events[3];
log_string("epoll_wait start");//here will print start time
events_len = epoll_wait(_epoll_fd, events, 3, 20 * 1000);// wait 20 second,for test,I use pipe instead of socket,monitor a pipe EPOLLIN event
if (events_len <= 0) {
log_string("epoll_wait end events_len=%d,errno=%d", events_len, errno);//Normally,the events_len always is 0,and errno is 0
}
}
The above code runs on the PC(like Ubuntun PC) is very normal,as expected.
If it runs on Android Phone(use Android Service , separate thread to run) is as expected at first.
After some time,epoll_wait becomes not very accurate,sometimes got -1 and errno=4,sometimes waited very long.
So I only know that phenomenon, but do not know why.
Can you tell why and tell me the best practices for use android epoll?
thx
4 is EINTR, which means your app got a signal. This isn't really an error, just restart epoll.
Regarding "waited very long", does your app hold at least a partial wakelock?
I write simple program to get various information: signal strength, cell info etc... To test I use two phones with the same Android version 2.1 - Sony Ericsson and Samsung Galaxy Spice.
To extract Neighbour Cell Info I use:
telephonyConnectionAdapter.getNeighboringCellInfos()
On SE I am able to get Neighbour Cell info and in adb logcat -b radio I can see:
D/GSM ( 488): [GsmSST] Poll ServiceState done: oldSS=[0 home T-Mobile.pl
T- Mobile.pl 26002 EDGE:2 CSS not supported -1 -1 RoamInd=-1 DefRoamInd=-1
EmergOnly=false] newSS=[0 home T-Mobile.pl T-Mobile.pl 26002 EDGE:2 CSS not
supported -1 -1 RoamInd=-1 DefRoamInd=-1 EmergOnly=false] oldGprs=0 newData=0
oldMaxDataCalls=20 mNewMaxDataCalls=20
oldReasonDataDenied=-1 mNewReasonDataDenied=-1 oldType=EDGE:2 newType=EDGE:2
D/GSM ( 488): [EONS] Reading data from EF_OPL or EF_PNN is not complete.
Suppress operator name display until all EF_OPL/EF_PNN data is read.
D/RILJ ( 488): [8847]> REQUEST_GET_NEIGHBORING_CELL_IDS
D/RILJ ( 488): [8847]< REQUEST_GET_NEIGHBORING_CELL_IDS [b01b59c7#18 [b01b5260#27] [] [b01b63f9#19] [b01b2f4f#17]
but the same application could not extract Neighbour Cell Info on Samsung - the list is empty and adb logcat -b radio looks:
D/GSM ( 1993): Poll ServiceState done: oldSS=[0 home Play Play 26006 (manual)
EDGE CSS not supported -1 -1RoamInd: -1DefRoamInd: -1] newSS=[0 home Play Play
26006 (manual) EDGE CSS not supported -1 -1RoamInd: -1DefRoamInd: -1] oldGprs=0
newGprs=0 oldType=EDGE newType=EDGE D/RILJ ( 1993): [5590]> REQUEST_GET_NEIGHBORING_CELL_IDS
D/RILC ( 1855): [5590]> GET_NEIGHBORING_CELL_IDS
D/RILC ( 1855): [5590]< GET_NEIGHBORING_CELL_IDS fails by E_REQUEST_NOT_SUPPORTED
D/RILJ ( 1993): [5590]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android.internal.telephony.CommandException: REQUEST_NOT_SUPPORTED
The is one more important information. When I use magic code *#*#197328640#*#* on Samsung and enter to service menu. There are few visible Neighbour Cells.
Any idea what is going on? Or at least what does this mean?
"com.android.internal.telephony.CommandException: REQUEST_NOT_SUPPORTED"
Each manufacturer implements the low level functionality for their devices as they see fit. In this case, Samsung has decided not to support this feature on this device. This means that you will not be able to get the list of neighboring cells on this device.